package dao;

import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;

import entity.UserLoginLog;

public class UserLoginLogDAO {
	
	private SqlSessionFactory sqlSessionFactory = null;
	
	public int AddUserLoginLog(UserLoginLog userLoginLog){
		SqlSession session = null;
		try{
			session = sqlSessionFactory.openSession();
			int r = session.insert("entity.UserLoginLog.insertUserLoginLog", userLoginLog);
			session.commit();
			return r;
		}catch(Exception e){
			session.rollback();
			e.printStackTrace();
			return -1;
		}finally{
			if(session != null)
				session.close();
		}

	}
	
	public void setSqlSessionFactory(SqlSessionFactory sqlSessionFactory) {
		this.sqlSessionFactory = sqlSessionFactory;
	}
}
